<template>
  <a-list class="card">
    <template #header>团队列表</template>
    <a-list-item v-for="item in teamList">
      <div class="team-info-box">
        <div class="team-info">
          {{ item.teamName }}
        </div>
        <a-button type="primary" @click="selectTeam(item)">选择</a-button>
      </div>
    </a-list-item></a-list
  >
</template>

<script setup lang="ts">
import { useUserStore } from '@/stores'
import router from '@/router'

interface Props {
  teamList: any
}

const userStore = useUserStore()
withDefaults(defineProps<Props>(), {
  teamList: []
})
const selectTeam = (item: any) => {
  userStore.setTeam(item.id)
  router.push({ path: '/' })
}
</script>

<style scoped lang="scss">
.team-info-box {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  .team-info {
    font-size: 16px;
    font-weight: bold;
  }
}
</style>
